Imports System
Imports System.Collections.Generic
Imports DevExpress.ExpressApp.DC
Imports DevExpress.Persistent.Base

<DomainComponent()> _
Public Interface IPerson
    Property LastName() As String
    Property FirstName() As String
    ReadOnly Property FullName() As String
    Sub Copy(ByVal target As IPerson)
End Interface

<DomainComponent()> _
Public Interface IOrder
    ReadOnly Property Items() As IList(Of IOrderItem)
End Interface
<DomainComponent()> _
Public Interface IOrderItem
    Property Order() As IOrder
End Interface

<DomainComponent()> _
Public Interface IEmployee
    ReadOnly Property Tasks() As IList(Of ITask)
End Interface
<DomainComponent()> _
Public Interface ITask
    ReadOnly Property Employees() As IList(Of IEmployee)
End Interface

<DomainComponent()> _
Public Interface IAccount
    <BackReferenceProperty("AccountOne")> _
    ReadOnly Property ContactA() As IList(Of IContact)
    <BackReferenceProperty("AccountTwo")> _
    ReadOnly Property ContactB() As IList(Of IContact)
    ReadOnly Property ContactC() As IList(Of IContact)
End Interface
<DomainComponent()> _
Public Interface IContact
    Property AccountOne() As IAccount
    Property AccountTwo() As IAccount
    Property AccountThree() As IAccount
End Interface


' To use a Domain Component in an XAF application, the Component should be registered.
' Override the ModuleBase.Setup method in the application's module and invoke the ITypesInfo.RegisterEntity method in it:
'
' Public Overrides Sub Setup(ByVal application As XafApplication)
'     XafTypesInfo.Instance.RegisterEntity("MyComponent", GetType(IPerson))
'     MyBase.Setup(application)
' End Sub

'<DomainLogic(GetType(IPerson))> _
'Public Class IPersonLogic
'    Public Shared Function Get_CalculatedProperty(ByVal instance As IPerson) As String
'        ' A "Get_" method is executed when getting a target property value. The target property should be readonly.
'        ' Use this method to implement calculated properties.
'        Return ""
'    End Function
'    Public Shared Sub AfterChange_PersistentProperty(ByVal instance As IPerson)
'        ' An "AfterChange_" method is executed after a target property is changed. The target property should not be readonly. 
'        ' Use this method to refresh dependant property values.
'    End Sub
'    Public Shared Sub AfterConstruction(ByVal instance As IPerson)
'        ' The "AfterConstruction" method is executed only once, after an object is created. 
'        ' Use this method to initialize new objects with default property values.
'    End Sub
'    Public Shared Function SumMethod(ByVal instance As IPerson, ByVal val1 As Integer, ByVal val2 As Integer) As Integer
'        ' You can also define custom methods.
'        Return val1 + val2
'    End Function
'End Class
